<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">	
	
	<xsl:include href="../../main.xsl" />
	<xsl:include href="../menu.xsl" />
	<xsl:include href="../../common/form.xsl" />
	
	<xsl:template match="/data">
		<html>
		
		<head>
			<title>
				<xsl:value-of select="$pageTitle" />
			</title>
			<xsl:call-template name="meta-head" />
			<link rel="stylesheet" href="{$baseURI}/css/forms.css" type="text/css" media="all" />
			<script type="text/javascript" src="{$baseURI}/js/blogs.js" />
			<script type="text/javascript" src="{$baseURI}/js/simpleEditor.js" />
		</head>
		<body>
			
			<xsl:call-template name="top-userbar" />

			<div class="page-header">
				<xsl:call-template name="logo" />

				<xsl:call-template name="menu" />
			</div>

			<div class="page-content-wrapper">
				<div class="page-blocks">
					<xsl:call-template name="default-blocks-top" />
				</div>
	
				<div class="page-content">
					<xsl:apply-templates select="response" />
				</div>
			</div>

			<xsl:call-template name="footer" />
		</body>
		</html>
	</xsl:template>
	
	<xsl:template match="response">
		
		<xsl:if test="$method = 'create_blog'">
			<h1>Новый блог</h1>
		</xsl:if>
		
		<xsl:if test="$method = 'edit_blog'">
			<h1>Редактирование блога</h1>
			
			<div class="tabs">
				<ul>
					<li class="selected">
						<a href="{$baseURI}/blogs/edit_blog/{$formPrefix}">Информация</a>
						
						<i class="corner-mask-eee-5 tl"></i>
						<i class="corner-mask-eee-5 tr"></i>
						<i class="corner-mask-eee-5 br"></i>
						<i class="corner-mask-eee-5 bl"></i>
					</li>
					<li>
						<a href="{$baseURI}/blogs/edit_blog_members/{$formPrefix}">Участники</a>
						
						<i class="corner-mask-eee-5 tl"></i>
						<i class="corner-mask-eee-5 tr"></i>
						<i class="corner-mask-eee-5 br"></i>
						<i class="corner-mask-eee-5 bl"></i>
					</li>
				</ul>
			</div>
		</xsl:if>
		
		<form action="{$baseURI}/blogs/create_blog/save" method="post" enctype="multipart/form-data">
			<xsl:if test="$method = 'edit_blog'">
				<xsl:attribute name="action">
					<xsl:value-of select="concat ($baseURI, '/blogs/edit_blog/', $formPrefix, '/save')" />
				</xsl:attribute>
			</xsl:if>
			
			<xsl:for-each select="form/field">
				<xsl:choose>
					<xsl:when test="@name = 'alias' and $method = 'edit_blog'"></xsl:when>
					
					<xsl:otherwise>
						<xsl:apply-templates select="." />
					</xsl:otherwise>
				</xsl:choose>
			</xsl:for-each>
			
			<p>
				<input type="submit" value="Создать блог">
					<xsl:if test="$method = 'edit_blog'">
						<xsl:attribute name="value">
							<xsl:text>Сохранить блог</xsl:text>
						</xsl:attribute>
					</xsl:if>
				</input>		
			</p>
		</form>
	</xsl:template>
	
</xsl:stylesheet>